package huoye.shops.widget;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.codeideology.android.widget.ios.dialog.base.BaseDialog;

import huoye.shops.R;


/**
 * Created by uesr on 2018/8/11.
 */

public class CommonHintDialog extends BaseDialog<CommonHintDialog> {



    private Context mContext;
    private TextView tvTitle;
    private TextView tvLeft;
    private TextView tvRight;


    public CommonHintDialog(Context context) {
        super(context);
        this.mContext = context;
    }

    @Override
    public View onCreateView() {
        widthScale(0.75f);
        View inflate = View.inflate(context, R.layout.dialog_common_hint, null);
       tvTitle = (TextView) inflate.findViewById(R.id.dialog_hint_title_tv_title);
        tvLeft = (TextView) inflate.findViewById(R.id.dialog_hint_title_tv_left);
        tvRight = (TextView) inflate.findViewById(R.id.dialog_hint_title_tv_right);

        return inflate;
    }

    @Override
    public void setUiBeforShow() {
       tvLeft.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                listener.onLeftClick();
                dismiss();
            }
        });
        tvRight.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                listener.onRightClick();
                dismiss();
            }
        });
    }


    public void setDialogContent(String title,String leftTv,String rightTv){
        tvTitle.setText(title);
        tvLeft.setText(leftTv);
        tvRight.setText(rightTv);
    }

    public interface OnCommonHintListener {
        void onLeftClick();
        void onRightClick();
    }
    public void setOnCommonHintListener(OnCommonHintListener onListener) {
        this.listener = onListener;
    }

    private OnCommonHintListener listener;

}
